import {defineConfig} from 'vite'
import react from '@vitejs/plugin-react'

// https://vite.dev/config/
export default defineConfig({
    plugins: [react()],
    base: '/static/',
    build: {
        // target: 'browser',
        outDir: '../server/src/main/resources/static',  // 直接输出到Java服务的文件目录
        sourcemap: true,
    },
    server: {
        port: 8000,
        proxy: {
            '/api': {
                target: 'http://localhost:8080',
                changeOrigin: true,
                rewrite: path => path.replace(/^\/api/, ''),
            }
        }
    }
})
